<?php
class GetData{

	protected  $con       = NULL;
	protected  $user      = NULL;
	protected  $naviModul = NULL;
	private    $Statistic = NULL;

	function GetData(){	
	    if(array_key_exists('UserId',$_SESSION)){
	        if(array_key_exists('session_check',$_SESSION)){
    	        if($_SESSION['session_check'] < date('Y-M-D H:i:s', time())){	

    	        	$Db_user_session = new Db_user_session();
    	            $Db_user_session->setSession($_SESSION['UserId']);
            		
		            $etime = strtotime("+5 minutes", time());
                    $_SESSION['session_check'] = date('Y-M-D H:i:s', $etime);
    	        }
	        }
	        if(isset($_COOKIE['GFW']['UCI'])){            
                $city = new Db_City();
                $selectetcity = $city->getCity($_COOKIE['UserCityId']);
                 
                $_SESSION ['Userlat']    = $selectetcity->lat;
                $_SESSION ['Userlng']    = $selectetcity->lng;
                $_SESSION ['UserCity']   = $selectetcity->name;
                
                HTTP::redirect(ConfigFile::Get('BASE_DIR'));
            }
            if(isset($this->daten["CacheKill"]) && is_numeric($this->daten["CacheKill"])){
                $this->expire_time = 0;
            }
            $user = new Db_User();
	        $this->ActivUser = $user->GetUserByID($_SESSION['UserId']);
	        
	        $visitorStatistic = new Db_user_page_visitor();
	        $this->Statistic = $visitorStatistic->getVisitorsTotalByUserIdStatistic($_SESSION['UserId']);
	        
	        $userNaviModul = new Db_user_page_explorer();
	        $this->naviModul = $userNaviModul->getUserNavigationModul($_SESSION['UserId']);
	        
	        if($this->Statistic)
	        	$this->design->assign("PageStatistic",$this->Statistic);
	        
	        if($this->ActivUser)
	        	$this->design->assign("UserData",$this->ActivUser);
	        	
	        if($this->naviModul)
	        	$this->design->assign("naviModul",$this->naviModul);
	        
	        if(isset($_SESSION["GlobError"])){	        	
	        	$this->design->assign("GlobError",$_SESSION["GlobError"]);	        	
                $this->expire_time = 0;
	        	unset($_SESSION["GlobError"]);
	        }
	        
	        unset($user);
	        unset($userNaviModul);
	    }else{
	       HTTP::redirect(ConfigFile::Get('BASE_DIR')."/login");
           die();
	    }
	}
}

?>